<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'da.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<meta http-equiv="content-type" content="text/html;charset=utf-8">

<link rel="stylesheet" href="js/easyui/demo/demo.css" type="text/css"></link>
<link rel="stylesheet" href="js/easyui/themes/icon.css" type="text/css"></link>
<link rel="stylesheet" href="js/easyui/themes/default/easyui.css"
	type="text/css"></link>
<script type="text/javascript" src="js/easyui/jquery-1.6.min.js"></script>
<script type="text/javascript" src="js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="script/common.js"></script>
<script type="text/javascript" src="js/easyui/themes/easyui-lang-zh_CN.js"></script>
<link href="css/style.css" rel="stylesheet" type="text/css">
<style type="text/css">

</style>
<script type="text/javascript">
	/**
	 * 根据制定页面跳转
	 */
	function reload() {
		var offset = document.getElementById("offset").value;
		var idx = (offset == null) ? 0 : parseInt(offset) - 1;
			
		window.location = 'cpgetCostcheckProductList?offset=' + idx;
	}
	
	/**
	 * 根据条件查询
	 */
	function query() {
		var productCode=$("#productCode").val();
		var priceSt = $("#priceSt").val();
		var priceEd = $("#priceEd").val();
		var timeSt = $("#timeSt").datebox('getValue');
		var timeEd = $("#timeEd").datebox('getValue');
		
		window.location = 'cpgetCostcheckProductList?productCode='+ productCode+'&priceSt='+ priceSt
					+'&priceEd='+priceEd+'&timeSt='+ timeSt+'&timeEd='+ timeEd;
		
	}
	
   /**
	* 翻到给定偏移量的页面
	*/
	function turnPage(offset){
		var productCode=$("#productCode").val();
		var priceSt = $("#priceSt").val();
		var priceEd = $("#priceEd").val();
		var timeSt = $("#timeSt").datebox('getValue');
		var timeEd = $("#timeEd").datebox('getValue');
		
		window.location = 'cpgetCostcheckProductList?productCode='+ productCode+'&priceSt='+ priceSt
					+'&priceEd='+priceEd+'&timeSt='+ timeSt+'&timeEd='+ timeEd+'&offset=' + offset;
				
	}
	
	
</script>
</head>

<body>
	<div style="margin:20px 20px 0px 20px; width:85%;">
		<div id="options" class="toolbar">
			<div style="width: 100%;float: none;">
				<div style="float: left;">
					<a onclick="addPanel('addcostcheckProd.jsp','新增成衣核价')" class="easyui-linkbutton"
						data-options="iconCls:'icon-add'" style="margin-right: 10px;">新增</a>
					<a href="cpgetCostcheckProductList" class="easyui-linkbutton"
						data-options="iconCls:'icon-reload'" style="margin-right: 10px;">刷新</a>
				</div>
				<div style="float: left; margin-bottom: 10px;">
					<input class="easyui-textbox" type="text" id="productCode" prompt="产品款号" value="${productCode}" data-options="height:26,width:100">
					<input class="easyui-textbox" type="text" id="priceSt" prompt="价格" value="${priceSt}" data-options="width:50,height:26">
					<span>-</span>
					<input class="easyui-textbox" type="text" id="priceEd" prompt="价格" value="${priceEd}" data-options="width:50,height:26">
					<input class="easyui-datebox" type="text" id="timeSt" prompt="开始时间" value="${timeSt}" data-options="width:100,height:26">
					<span>-</span>
					<input class="easyui-datebox" type="text" id="timeEd" prompt="结束时间" value="${timeEd}" data-options="width:100,height:26">
				</div>
				<div style=" float: left;">
					<input class="easyui-linkbutton"
						type="button" id="query" style="margin-left: 15px;"
						onclick="query()" value="查询 ">
				</div>
			</div>
		</div>
		
		<div style="width:70%; float: left;" id = "materialShow">
			<table class="easyui-datagrid" style="width=100%;" singleSelect="true">
				<thead>
					<tr>
						<th data-options="field:'code'" width="50" align="center">序号</th>
						<th data-options="field:'productCode'"  width="100"align="center">产品款号</th>
						<th data-options="field:'price '"  width="100" align="center">成衣价格</th>
						<th data-options="field:'sysUser'"  width="100" align="center">核算人员</th>
						<th data-options="field:'memo'"  width="150" align="center">备注</th>
						<th data-options="field:'createTime'"  align="center">创建时间</th>
						<th data-options="field:'操作'" align="center">操作</th>
					</tr>
				</thead>
				
				<c:choose>
					<c:when test="">
						<tr style="text-align: center;">
							<td colspan="11">
								<span style="color: grey;"></span>
							</td>
						</tr>
					</c:when>
					<c:otherwise>
						<c:forEach items="${allCostcheckProduct}" var="ccp" varStatus="i">
							<tr>
								<td>${i.index+1+offset*10 }</td>
								<td>${ccp.productCode}</td>
								<td>${ccp.price}</td>
								<td>${ccp.sysUser}</td>
								<td>${ccp.memo}</td>
								<td>
									<fmt:setLocale value="zh_cn" />
									<a href="" title="${ccp.createTime}"><font><fmt:formatDate value="${ccp.createTime}" type="date" dateStyle="long" /></font></a>
								</td>
								<td>
									<a onclick="addPanelExists('cpfindCostcheck?chId=${ccp.chId}','修改产品核价')" style="text-decoration: underline;">编辑</a><b>|</b>
									<a onclick="" style="text-decoration: underline;">删除</a><b>|</b>
									<a onclick="addPanelExists('cpjumpCostJsp?chId=${ccp.chId}','产品核价')" style="text-decoration: underline;">核价</a>
								</td>
							</tr>
						</c:forEach>
					</c:otherwise>
				</c:choose>
			</table>
			<div class="pager" id="pagebar">
				共<b id="ttCount">${totalcount }</b>条记录 转到&nbsp;<input value="${offset+1}" size="2" id="offset" class="easyui-textbox" />&nbsp;页/<b id="ttPage">${totalpage }</b>页
				<button class="easyui-linkbutton jump-btn" width="20" onclick="reload()">跳转</button>
				<a onclick="turnPage(0)">&lt;&lt; 第一页</a> <a
					onclick="turnPage(${offset-1})">&lt; 上一页</a> <a
					onclick="turnPage(${offset+1})">下一页 &gt;</a> <a
					onclick="turnPage(${totalpage-1})">最后一页 &gt;&gt;</a>
			</div>
		</div>
	</div>
</body>
</html>
